package com.qianclass.talklive.app.view;

import android.app.Dialog;
import android.content.Context;
import android.os.Bundle;
import android.view.View;

import com.qianclass.talklive.R;


/**
 * Created by Admin on 2017/3/8.
 */

public class ChooseColorDialog extends Dialog implements View.OnClickListener{


    public ChooseCallBack mChooseCallBack;
    private String[] colors;

    public ChooseColorDialog(Context context, ChooseCallBack chooseCallBack) {
        super(context, R.style.color_choose_dialog);
        this.mChooseCallBack = chooseCallBack;
    }


    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.choose_color_dialog_layout);
        colors = new String[]{"#FF0000", "#000000", "#0000FF", "#FFB3A9"};
        findViewById(R.id.button_red).setOnClickListener(this);
        findViewById(R.id.button_black).setOnClickListener(this);
        findViewById(R.id.button_blue).setOnClickListener(this);
        findViewById(R.id.button_orange).setOnClickListener(this);
    }



    @Override
    public void onClick(View v) {
        switch (v.getId()) {
            case R.id.button_red:
                mChooseCallBack.chooseColorClick(colors[0]);
                dismiss();
                break;
            case R.id.button_black:
                mChooseCallBack.chooseColorClick(colors[1]);
                dismiss();
                break;
            case R.id.button_blue:
                mChooseCallBack.chooseColorClick(colors[2]);
                dismiss();
                break;
            case R.id.button_orange:
                mChooseCallBack.chooseColorClick(colors[3]);
                dismiss();
                break;
        }
    }

    public interface ChooseCallBack {
        void chooseColorClick(String color);
    }
}
